import request from '@/utils/request'

export function addCatetory(pid, name) {
  return request({
    url: '/category/add',
    method: 'post',
    data: {
      pid,
      name
    }
  })
}

export function selectAllCatetory() {
  return request({
    url: '/category/all',
    method: 'get'
  })
}

export function deleteCategory(id) {
  return request({
    url: 'category/' + id + '/del',
    method: 'post'
  })
}

export function updateCategory(id, pid, name) {
  return request({
    url: 'category/' + id + '/update',
    method: 'post',
    data: {
      pid,
      name
    }
  })
}

